package cn.tedu.map;

import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author ：Dsi
 * @date ：2021/11/19 10:32
 * Describe ：
 */
public class TestMap02 {
    public static void main(String[] args) throws IOException {
//        System.out.println("请输入字符串：");
//        String s=new Scanner(System.in).nextLine();
      BufferedInputStream b=new BufferedInputStream(new FileInputStream("D:\\SecondElement_SourceCode\\1.txt"));
        byte[] a = new byte[1024 * 10];
        String[] s=new String[10];
        for (int i = 0; b.read(a)!=-1 ; i++) {
            s[i]=new String(a,0,a.length);
        }
        String s1=Arrays.toString(s);
        Map<Character,Integer> getMap=new HashMap<>();
        for (int i = 0; i < s1.length(); i++) {
            char key = s1.charAt(i);
            if(getMap.get(key)==null){
                getMap.put(key,1);
            }else {
                Integer a1=getMap.get(key);
                getMap.put(key,a1+1);
            }
        }
        System.out.println(getMap);
    }
}
